#ifndef SWP_SIM_ACTIVITY_GRAPHIC_ITEM_H
#define SWP_SIM_ACTIVITY_GRAPHIC_ITEM_H

#include "isimitem.h"
#include "swpactivitygraphicitem.h"

namespace swp
{
class SimMark;

class SwpSimActivityGraphicItem : public SwpActivityGraphicItem,
    public ISimItem
{
public:
    SwpSimActivityGraphicItem(QGraphicsItem* parent = 0);
    SwpSimActivityGraphicItem(SwpActivityGraphicItem* from,
        QGraphicsItem* parent = 0);
    ~SwpSimActivityGraphicItem();

    bool supportsConnection(
        const core::ConnectionData& connection) const;

    int type() const;

    IEditorItem* copy() const;

    // ISimItem
    bool isInSimPath() const;
    void setInSimPath(bool in = true);
    QUuid originId() const;

    // ISerializable
    void deserializationFinished(bool ok);

    // IPropertyObject
    QList<core::Property> properties() const;

    QVariant propertyValue(const QString& propertyName) const;

    void propertyChanged(const QString& property,
        const QVariant& newValue, bool silent = false);

    QVariantList optionList(const QString& propertyName) const;
    QVariantList autocomplete(const QString& propertyName) const;

    void repositionMarks();

protected:
    QVariant itemChange(GraphicsItemChange change,
        const QVariant &value);

private:
    void initProperties();
    void initMarks();
    void tryToAddMarks();

private:
    bool m_isInSimPath;
    QUuid m_originId;
    core::Property m_origin;
    core::Property m_cost;
    core::Property m_duration;
    SimMark* m_costMark;
    SimMark* m_durationMark;
    bool m_added;
};

} // namespace swp

#endif
